package com.xxx.store.controller;

import com.xxx.store.entity.Apply;
import com.xxx.store.entity.User;
import com.xxx.store.service.ApplyService;
import com.xxx.store.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/apply")
public class ApplyController extends BaseController <Apply, ApplyService>{
    @Autowired
    ApplyService applyService;

    @PostMapping("add")
    public Result add(@RequestBody Apply apply) {
        Date date = new Date();
        apply.setCreateTime(date);
        applyService.save(apply);
        return Result.ok("添加成功", apply);
    }

    @GetMapping("/list")
    public Result list(){
        List<Apply> applies = applyService.list();
        return Result.ok(applies);
    }


}
